﻿using DadayunApi.Model;
using KbtSync.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KbtSync.Model
{
    /// <summary>
    /// 表单实例查询时用于json解释的类，用于接收查询表单实例的返回信息
    /// </summary>
    public class ReceivingStorageForm : RecieveFormTemplateBase
    {
        public MainFieldDataAction Title { get; set; }
        public MainFieldDataAction ProdName { get; set; }
        public MainFieldDataAction ErpItemCode { get; set; }

        public ReceivingStorageFormSubField Storages { get; set; }
        public StorageForm ToStorageForm()
        {

            StorageForm obj = new StorageForm
            {
                ErpItemCode = ErpItemCode.Value,
                Id = Id,
                ProdName = ProdName.Value,
                Storages = Storages.Value
            };
            return obj;
        }
    }

    public class ReceivingStorageFormSubField
    {
        public SubFieldsRoleAction SubFieldsRoleAction { get; set; }
        public bool C { get; set; }
        public bool R { get; set; }
        public bool U { get; set; }
        public bool D { get; set; }
        public List< Storage> Value { get; set; }
    }

    public class StorageValueItem
    {
        public string Id { get; set; }
        public string Warehouse { get; set; }
        public double StoreQty { get; set; }
        public double LockQty { get; set; }
        //[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        //public DateTime LockToDate { get; set; }
        public double UsableQty { get; set; }
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string Note { get; set; }
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public DateTime CreateTime { get; set; }
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string OrderIndex { get; set; }
    }
    public class SubFieldsRoleAction
    {
        public RoleAction Warehouse { get; set; }
        public RoleAction StoreQty { get; set; }
        public RoleAction LockQty { get; set; }
        //public RoleAction LockToDate { get; set; }
        public RoleAction UsableQty { get; set; }
        public RoleAction Note { get; set; }
        public RoleAction CreateTime { get; set; }
    }
}
